package sparrowGui.components.item
{
	import flash.events.MouseEvent;
	
	/** 项数据更新. **/
	[Event(name="item_update", 	type="sparrowGui.event.ItemEvent")]
	/** 项选中状态改变. **/
	[Event(name="item_select_change", 	type="sparrowGui.event.ItemEvent")]
	/** 项可用状态改变. **/
	[Event(name="item_ebable_change", 	type="sparrowGui.event.ItemEvent")]

	/**
	 * 六状按钮,经SButton多了可选和可用两状态。
	 * 
	 * 例子如下
	 * 
	 * var itm:SItem = new SRichButton();
		itm.update("按钮文字");
		addChild(itm);
	 * 
	 * @author Pelephone
	 * @website http://cnblogs.com/pelephone
	 */
	public class SRichButton extends SListItem
	{
		/**
		 * 构造列表项
		 * @param uiVars
		 */
		public function SRichButton(uiVars:Object=null)
		{
			super(uiVars);
		}
		
		override protected function addSkinListen():void
		{
			super.addSkinListen();
			skin.addEventListener(MouseEvent.CLICK,onMouseClick);
		}
		
		override protected function removeSkinListen():void
		{
			super.removeSkinListen();
			skin.removeEventListener(MouseEvent.CLICK,onMouseClick);
		}
		
		protected function onMouseClick(e:MouseEvent):void
		{
			if(!enabled)
				return;
			
			selected = !selected;
		}
		
		override public function getDefaultUIName():String
		{
			return "richButton";
		}
	}
}